/*
package com.thread.threadfirst.marvel.citymaster.service;

import com.fugui.marvel.service.citymaster.annotation.Log;
import com.fugui.marvel.service.citymaster.annotation.LogTypeEnum;
import com.fugui.marvel.service.citymaster.conf.PropertiesConfig;
import com.fugui.marvel.service.citymaster.conf.RedisKeyGeneratorConfig;
import com.fugui.marvel.service.citymaster.entity.Query;
import com.fugui.marvel.service.citymaster.enums.*;
import com.fugui.marvel.service.citymaster.mapper.ApplyCityMasterMapper;
import com.fugui.marvel.service.citymaster.mapper.CityConfigMapper;
import com.fugui.marvel.service.citymaster.mapper.IncomeDetailsMapper;
import com.fugui.marvel.service.common.domain.user.TUser;
import com.fugui.marvel.service.common.dto.ReturnT;
import com.fugui.marvel.service.common.dto.citymaster.*;
import com.fugui.marvel.service.common.service.dto.PageInfo;
import com.fugui.marvel.service.common.service.feign.client.citymaster.FeignCityConfigServiceClient;
import com.fugui.marvel.service.common.service.feign.client.user.FeignUserServiceClient;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.*;
import java.util.stream.Collectors;

import static com.fugui.marvel.common.utils.DateUtilHelper.*;

*/
/**
 * @author yinwensheng
 * @date
 *//*

@Api("城市配置Service")
@Service
@RestController
@Transactional(rollbackFor = Exception.class)
public class CityConfigServiceImpl implements FeignCityConfigServiceClient {


    */
/**
     *log
     *//*

    private static final Logger log = LoggerFactory.getLogger(CityConfigServiceImpl.class);

    */
/**
     *cityConfig
     *//*

    @Autowired
    CityConfigMapper cityConfigMapper;


    */
/**
     *applyCityMaster
     *//*

    @Autowired
    ApplyCityMasterMapper applyCityMasterMapper;

    */
/**
     *incomeDetail
     *//*

    @Autowired
    IncomeDetailsMapper incomeDetailsMapper;

    */
/**
     *user
     *//*

    @Autowired
    FeignUserServiceClient feignUserServiceClient;


    */
/**
     *redis
     *//*

    @Autowired
    RedisService feignRedisServiceClient;

    */
/**
     *
     *//*

    @Autowired
    PropertiesConfig propertiesConfig;

    */
/**
     *
     *//*

    @Autowired
    RedisKeyGeneratorConfig redisKeyGeneratorConfig;




    */
/**
     *
     *//*

    @Log(prefix = "查询分页", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST , value = "/m2.0/citymaster/save/cityconfig/findByPage", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public PageInfo<CityConfigDTO> findByPage(int currPage, int pageSize) {
        PageHelper.startPage(currPage, pageSize);
        com.github.pagehelper.Page<CityConfigDTO> cityConfigDTOS = cityConfigMapper.findByPage();
        PageInfo<CityConfigDTO> pageInfo = new PageInfo<>(cityConfigDTOS);
        return  pageInfo;
    }


    */
/**
     * 筛选能够参与此活动的资格接口 --
     *//*

    @Log(prefix = "筛选能够参与此活动的资格接口", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/save/cityconfig/queryPageList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public List<CityConfigDTO> queryPageList(int currPage, int pageSize) {
        Query query = new Query();
        query.put("currIndex", (currPage - 1) * pageSize);
        query.put("pageSize", pageSize);
        List<CityConfigDTO> list = cityConfigMapper.queryCityConfigBySql(query);
        return list;
    }


    */
/**
     * 添加关注
     *//*

    @Log(prefix = "添加关注", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/query/cityRevenueRanking/addFocus", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public ReturnT<Boolean> addFocus(@RequestParam(value = "userId") Long userId, @RequestParam(value = "cityId") Long cityId) {
        ReturnT<Boolean> ReturnT = new ReturnT<>();
        try {
            String key= redisKeyGeneratorConfig.getFocusKey(cityId,userId);
            feignRedisServiceClient.sadd(key, userId.toString());
            //@TODO focus history to mysql
            ReturnT.returnSuccess(true);
            return ReturnT;
        } catch (Exception e) {
            ReturnT.returnFail(e.getMessage());
            return ReturnT;
        }

    }


    */
/**
     * 取消关注
     *//*

    @Log(prefix = "取消关注", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/query/cityRevenueRanking/cancelFocus", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public ReturnT<Boolean> cancelFocus(@RequestParam(value = "userId") Long userId, @RequestParam(value = "cityId") Long cityId) {
        ReturnT<Boolean> ReturnT = new ReturnT<>();
        try {
            String key= redisKeyGeneratorConfig.getFocusKey(cityId,userId);
            feignRedisServiceClient.srem(key, userId.toString());
            ReturnT.returnSuccess(true);
            return ReturnT;
        } catch (Exception e) {
            ReturnT.returnFail(e.getMessage());
            return ReturnT;
        }

    }


    */
/**
     * 提交城市配置接口
     *//*

    @Log(prefix = "提交城市配置接口", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/save/cityconfig/save", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public int save(@RequestBody CityConfigDTO request) {
        int count = cityConfigMapper.save(request);
        return count;
    }


    */
/**
     * 即将上线的城市接口 --
     *//*

    @Log(prefix = "即将上线的城市接口", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/query/cityRevenueRanking/getComingOnlineSoon", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public ReturnT<List<CityConfigDTO>> getComingOnlineSoon() {
        ReturnT<List<CityConfigDTO>> returnT = new ReturnT<>();
        try {
            Query query = new Query();
            query.put("cityStatus", CityConfigStatus.CCS1.getValue());
            Optional<List<CityConfigDTO>> list = Optional.ofNullable(cityConfigMapper.getCityByCityStatus(query));
            if (list.isPresent()){
                returnT.returnSuccess(list.get());
            }
        } catch (Exception e) {
            returnT.returnFail(e.getMessage());
        }
        return returnT;
    }


    */
/**
     * 首页城市列表接口  收益  列表根据城市状态获取城市列表  城市状态 0：初始化 1：待开放 2：已开放  3：已下线  0全部城市 1 有空位 2 即将到期 3 即将上线
     *//*

    @Log(prefix = "首页城市列表接口", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/query/cityRevenueRanking/getCityList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public ReturnT<List<CityRevenueRankingDTO>> getCityList(@RequestParam(value = "loginUserId") Long loginUserId, @RequestParam(value = "type") Integer type) {
        long startTime1=System.currentTimeMillis();   //获取开始时间
        ReturnT<List<CityRevenueRankingDTO>> returnT = new ReturnT<>();
        try {
            //0全部城市
            List<CityRevenueRankingDTO> result = getCityListByType(loginUserId);
            if (type.equals(SearchListStatus.SLS0.getValue())) {
                returnT.returnSuccess(result);
                return returnT;
            } else if (type.equals(SearchListStatus.SLS1.getValue())) {
                //1有空位   false 无空位 true 有空位
                List<CityRevenueRankingDTO> getIsVacancyList = result.stream().filter((x) -> x.getIsVacancy().equals(true)).collect(Collectors.toList());
                returnT.returnSuccess(getIsVacancyList);
                return returnT;
            } else if (type.equals(SearchListStatus.SLS2.getValue())) {
                //2即将到期
                List<CityRevenueRankingDTO> getSoonExpiryTimeList = result.stream().filter((x) ->x.getHours()!=null && x.getHours() <= 48  &&x.getHours()>0).collect(Collectors.toList());
                returnT.returnSuccess(getSoonExpiryTimeList);
                return returnT;
            }
        } catch (Exception e) {
            returnT.returnFail(e.getMessage());
        }
        long endTime1=System.currentTimeMillis(); //获取结束时间
        log.info("城主程序运行时间： "+(endTime1-startTime1)+"ms");
        return returnT;



    }


    */
/**
     * 查询所有已上线城市
     * @param loginUserId
     * @return
     *//*

    private List<CityRevenueRankingDTO> getCityListByType(@RequestParam(value = "loginUserId") Long loginUserId) {
        List<CityRevenueRankingDTO> result = new ArrayList<>();
        try {
            Query querySelect = new Query();
            querySelect.put("cityStatus", CityConfigStatus.CCS2.getValue());
            List<CityConfigDTO> list = cityConfigMapper.getCityByCityStatus(querySelect);

            list.stream().forEach((x) -> {
                CityRevenueRankingDTO dto = new CityRevenueRankingDTO();

                dto.setCityName(x.getCityName());
                dto.setCityCode(x.getCityCode());
                dto.setCityId(x.getId());


                long startTime1=System.currentTimeMillis();   //获取开始时间
                //是否关注
                String key = redisKeyGeneratorConfig.getFocusKey(x.getId(), loginUserId);
                if (feignRedisServiceClient.sismember(key, loginUserId.toString())) {
                    dto.setIsFocus(true);
                } else {
                    dto.setIsFocus(false);
                }

                //是否有空位
                if (x.getIsCityMaster() && x.getIsCityDeputy1() && x.getIsCityDeputy2()) {
                    dto.setIsVacancy(false);
                } else {
                    dto.setIsVacancy(true);
                }
                long endTime1=System.currentTimeMillis(); //获取结束时间
                log.info("城主是否关注程序运行时间： "+(endTime1-startTime1)+"ms");


                //TotalPrice & time
                List<BigDecimal> bigDecimals = new ArrayList<>();
                List<Date> expiryTimes = new ArrayList<>();
                Query query = new Query();
                query.put("cityId", x.getId());
                query.put("applyStatus", ApplyCityStatus.CS2.getValue());//当选
                List<ApplyCityMasterDTO> result1 = applyCityMasterMapper.getCityMasterAndDeputy(query);//1个城主2个副城主
                result1.stream().map((y) -> {
                    expiryTimes.add(y.getExpiryTime());
                    bigDecimals.add(getCityMasterRealIncome(y));
                    return y;
                }).collect(Collectors.toList());

                //当前城主总收益
                BigDecimal total = bigDecimals.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
                total = total.setScale(2, BigDecimal.ROUND_UP);
                dto.setDay10Income(total);

                //城市总收益
                Query cityQuery = new Query();
                cityQuery.put("cityId", x.getId());
                cityQuery.put("applyStatus", IncomeStatus.IS1.getValue());
                Optional<IncomeDetailsDTO> incomeDetailsDTO = Optional.ofNullable(incomeDetailsMapper.getCityIncomeByCityId(cityQuery));
                if (incomeDetailsDTO.isPresent()) {
                    dto.setCityTotalIncome(new BigDecimal(incomeDetailsDTO.get().getOriginPrice()));
                }else {
                    dto.setCityTotalIncome(BigDecimal.ZERO);
                }

                //time
                Date nowTime = new Date();
                Optional<Date> first = expiryTimes.stream().sorted().findFirst();
                if (first.isPresent()) {
                    Date endTime = first.get();
                    dto.setExpiryTime(endTime);
                    if(endTime.compareTo(nowTime)>0){
                        dto.setHours(getHours(nowTime, endTime));
                    }

                } else {
                    dto.setHours(null);
                }
                result.add(dto);
            });

            //总收益排序
            List<CityRevenueRankingDTO> allCity = result.stream().sorted(Comparator.comparing(CityRevenueRankingDTO::getCityTotalIncome).reversed()).collect(Collectors.toList());
            return allCity;

        } catch (Exception e) {
            log.info(e.getMessage());
        }
        return new ArrayList<>();

    }


    */
/**
     * 城市详情接口
     *
     * @param cityId
     * @return
     *//*

    @Log(prefix = "城市详情接口", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/query/cityRevenueRanking/getCityDetail", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public ReturnT<List<CityMasterDetailDTO>> getCityDetail(@RequestParam(value = "loginUserId") long loginUserId, @RequestParam(value = "cityId") long cityId) {
        ReturnT<List<CityMasterDetailDTO>> ReturnT = new ReturnT<>();
        try {

            List<CityMasterDetailDTO> result = new ArrayList<>();
            Query query = new Query();
            query.put("id", cityId);
            Optional<CityConfigDTO> optionalCityConfigDTO = Optional.ofNullable(cityConfigMapper.getObjectById(query));
            if (optionalCityConfigDTO.isPresent()) {

                getCityDTO(loginUserId,cityId, result, optionalCityConfigDTO.get());

            }
            ReturnT.returnSuccess(result);
            return ReturnT;

        } catch (Exception e) {
            ReturnT.returnFail(e.getMessage());
        }
        return ReturnT;

    }


    */
/**
     *我的团队人数和直推人数
     * @param loginUserId
     * @return
     *//*

    @Log(prefix = "我的团队人数和直推人数", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/query/myTeamNumber", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public ReturnT<MyDetailDTO> myTeamNumber(Long loginUserId) {
        ReturnT<MyDetailDTO> returnT = new ReturnT<>();
        MyDetailDTO dto = new MyDetailDTO();

        //直推人数
        Integer count1 = feignUserServiceClient.getSonUser(loginUserId.toString(), 1, 15);
        //间推人数
        Integer count2 = feignUserServiceClient.getSonUser(loginUserId.toString(), 2, 15);
        //总人数=直推人数+间推人数
        Integer count = count1 + count2;

        dto.setTeamsNumber(count);
        dto.setStraightPushNumber(count1);
        returnT.returnSuccess(dto);
        return returnT;
    }






    */
/**
     * 是否是城主
     *
     * @param result
     * @param cityConfigDTO
     *//*

    private void getCityDTO(Long loginUserId,long cityId, List<CityMasterDetailDTO> result, CityConfigDTO cityConfigDTO) {

        List<ApplyCityType> enums = Arrays.asList(ApplyCityType.values());

        enums.stream().forEach((x) -> {

            Optional<ApplyCityMasterDTO> response = Optional.ofNullable(getDeputyCityElection(cityId, x.getValue()));
            if (response.isPresent()) {

                getCityMaster(loginUserId,result, cityConfigDTO, x.getValue(), response.get());

            } else {

                noGetCityMaster(result, cityConfigDTO, x.getValue());
            }
        });

    }


    */
/**
     * 查询这个城市副城主 是当选的
     *
     * @param cityId
     * @return
     *//*

    private ApplyCityMasterDTO getDeputyCityElection(long cityId, Integer cityType) {
        Query query = new Query();
        query.put("cityId", cityId);
        query.put("cityType", cityType);
        query.put("applyStatus", ApplyCityStatus.CS2.getValue());
        return applyCityMasterMapper.getDeputyCityElection(query);
    }


    */
/**
     * 存在城主和副城主
     *
     * @param result
     * @param cityConfigDTO
     *//*

    private void getCityMaster(Long loginUserId,List<CityMasterDetailDTO> result, CityConfigDTO cityConfigDTO, Integer cityType, ApplyCityMasterDTO applyCityMasterDTO) {
        CityMasterDetailDTO dto = new CityMasterDetailDTO();
        Optional<TUser> optionalTUser = Optional.ofNullable(feignUserServiceClient.getUserID(applyCityMasterDTO.getUserId()));
        if (optionalTUser.isPresent()) {
            dto.setUserName(optionalTUser.get().getFullname());
            dto.setUserLevel(optionalTUser.get().getGrade());
            dto.setGradeFloorId(optionalTUser.get().getGradeFloorId() != null ? optionalTUser.get().getGradeFloorId() : null);
            dto.setUserHeaderUrl(optionalTUser.get().getUserHeadUrl()!=null? optionalTUser.get().getUserHeadUrl():null);
        }
        dto.setCityType(cityType);
        dto.setCityName(cityConfigDTO.getCityName());
        dto.setUserId(applyCityMasterDTO.getUserId());
        dto.setCityId(applyCityMasterDTO.getCityId());

        Date endTime = applyCityMasterDTO.getExpiryTime();
        Date nowTime = new Date();
        if(isEffectiveDate(nowTime, applyCityMasterDTO.getElectionTime(), endTime)) {
            dto.setExpiryTime(endTime);
            Long day = getDistanceDays(endTime, nowTime);
            dto.setDaysRemaining(day);
            //判断日期是否相同,只判断年月是否相同
            if (isSameDate(nowTime, endTime)) {
                Date startDate = getDateString(getStringDate(nowTime) + propertiesConfig.getStartTime());
                Date endDate = getDateString(getStringDate(nowTime) + propertiesConfig.getEndTime());
                if (isEffectiveDate(nowTime, startDate, endDate)) {
                    dto.setIsProtection(false);
                    //剩余多少小时
                    dto.setHour(getHours(nowTime, endDate));
                    dto.setSeconds(subSecond(endDate, nowTime));
                } else {
                    dto.setIsProtection(true);
                }

            } else {
                dto.setIsProtection(true);
            }
        }
        //城主  团队人数 直推 +间推  接口调用
        if (cityType.equals(ApplyCityType.CT1.getValue())) {
            //团队人数

            //直推人数
            Integer count1 = feignUserServiceClient.getSonUser(applyCityMasterDTO.getUserId().toString(), 1, 15);
            //间推人数
            Integer count2 = feignUserServiceClient.getSonUser(applyCityMasterDTO.getUserId().toString(), 2, 15);
            //总人数=直推人数+间推人数
            Integer count = count1 + count2;


            //当前用户 直推人数
            Integer myCount3 = feignUserServiceClient.getSonUser(loginUserId.toString(), 1, 15);
            //当前用户 间推人数
            Integer myCount4 = feignUserServiceClient.getSonUser(loginUserId.toString(), 2, 15);
            //总人数=直推人数+间推人数
            Integer myCount = myCount3 + myCount4;

            //相差人数 = 城主团队人数-我的团队人数
            if (count > myCount) {
                Integer cha = count - myCount;
                dto.setDisparitiesNumber(cha);
            } else {
                dto.setDisparitiesNumber(0);
            }
            //团队人数
            dto.setTeamsNumber(count);
            //城主实时收益
            BigDecimal bigDecimalMaster = getCityMasterRealIncome(applyCityMasterDTO);
            dto.setRealTimeRevenue(bigDecimalMaster);

        } else {

            //直推人数
            Integer count1 = feignUserServiceClient.getSonUser(applyCityMasterDTO.getUserId().toString(), 1, 15);
            //当前用户 直推人数
            Integer myCount1 = feignUserServiceClient.getSonUser(loginUserId.toString(), 1, 15);
            //相差人数 = 城主团队人数-我的团队人数
            if (count1 > myCount1) {
                Integer cha = count1 - myCount1;
                dto.setDisparitiesNumber(cha);
            } else {
                dto.setDisparitiesNumber(0);
            }

            //直推人数
            dto.setStraightPushNumber(count1);
            //城主实时收益
            BigDecimal bigDecimalIncome = getCityMasterRealIncome(applyCityMasterDTO);
            dto.setRealTimeRevenue(bigDecimalIncome);
        }

        result.add(dto);
    }


    */
/**
     * 获取城主实时收益
     * @param applyCityMasterDTO
     * @return
     *//*

    private BigDecimal getCityMasterRealIncome(ApplyCityMasterDTO applyCityMasterDTO) {

        //get redis
//        String key=redisKeyGeneratorConfig.getCityMasterIncomeKey(applyCityMasterDTO.getCityId(),applyCityMasterDTO.getUserId(),applyCityMasterDTO.getCityType());
//        String price=feignRedisServiceClient.get(key);
//        if (!StringUtils.isEmpty(price)) {
//            return new BigDecimal(price);
//        }

        //db实时查询
        Query queryCiyMaster = new Query();
        queryCiyMaster.put("userId", applyCityMasterDTO.getUserId());
        queryCiyMaster.put("cityId", applyCityMasterDTO.getCityId());
        queryCiyMaster.put("cityType", applyCityMasterDTO.getCityType());
        queryCiyMaster.put("applyStatus", IncomeStatus.IS1.getValue());
        queryCiyMaster.put("startTime", applyCityMasterDTO.getElectionTime());
        queryCiyMaster.put("endTime", applyCityMasterDTO.getExpiryTime());
        List<IncomeDetailsDTO> list = incomeDetailsMapper.getIncomeDetailsByCityAndUser(queryCiyMaster);
        if (list != null && list.size() > 0) {
            BigDecimal amounts = list.stream().map(item -> new BigDecimal(item.getActualDeductionPrice()))
                    .reduce(BigDecimal.ZERO, BigDecimal::add);

            BigDecimal incomePrice= amounts.setScale(2, BigDecimal.ROUND_UP);
            //add redis
            //feignRedisServiceClient.set(key,incomePrice.toString(),null);
            return  incomePrice;
        }
        return new BigDecimal(0);
    }


    */
/**
     * 用户实时收益
     * @param userId
     * @param cityId
     * @param cityType
     * @return
     *//*

    @Log(prefix = "用户实时收益", value = LogTypeEnum.ALL)
    @RequestMapping(method = RequestMethod.POST, value = "/m2.0/citymaster/query/isncomeDetails/getRealTimeRevenue", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @Override
    public ReturnT<BigDecimal> getRealTimeRevenue(@RequestParam(value = "userId") long userId, @RequestParam(value = "cityId") long cityId, @RequestParam(value = "cityType") Integer cityType) {
        ReturnT<BigDecimal> returnT = new ReturnT<>();
        Query queryCityMaster = new Query();
        queryCityMaster.put("userId", userId);
        queryCityMaster.put("cityId", cityId);
        queryCityMaster.put("cityType", cityType);
        queryCityMaster.put("applyStatus", ApplyCityStatus.CS2.getValue());
        Optional<ApplyCityMasterDTO> result = Optional.ofNullable(applyCityMasterMapper.getCurrentUserIsApplyCampaign(queryCityMaster));
        if (result.isPresent()) {
            BigDecimal bigDecimal = getCityMasterRealIncome(result.get());
            returnT.returnSuccess(bigDecimal);
            return returnT;
        } else {
            String msg= MessageFormat.format("{0}","用户不存在");
            returnT.returnFail(msg);
            return returnT;
        }

    }


    */
/**
     * 没有城主或者副城主
     *
     * @param result
     * @param cityConfigDTO
     *//*

    private void noGetCityMaster(List<CityMasterDetailDTO> result, CityConfigDTO cityConfigDTO, Integer cityType) {

        CityMasterDetailDTO dto = new CityMasterDetailDTO();
        dto.setCityType(cityType);
        dto.setCityId(cityConfigDTO.getId());
        dto.setCityName(cityConfigDTO.getCityName());
        dto.setDisparitiesNumber(0);
        dto.setTeamsNumber(0);
        dto.setDisparitiesNumber(0);
        dto.setRealTimeRevenue(BigDecimal.ZERO);
        dto.setIsProtection(false);

        //候选去倒计时 24 小时
        //查询申请竞选的第一个用户 创建时间 +1天的倒计时
        Query query = new Query();
        query.put("cityId", cityConfigDTO.getId());
        query.put("cityType", cityType);
        query.put("applyStatus", ApplyCityStatus.CS1.getValue());
        //查询按照创建时间排序 第一个
        Optional<ApplyCityMasterDTO> applyCityMasterDTO = Optional.ofNullable(applyCityMasterMapper.getCampaignApplyUser(query));
        if (applyCityMasterDTO.isPresent()) {
            Date startDate = applyCityMasterDTO.get().getCreateTime();
            Date nowTime = new Date();
            //判断日期是否相同,只判断年月是否相同
            if (isSameDate(nowTime, startDate)) {
                Date endDate = getDateString(getStringDate(nowTime) + propertiesConfig.getEndTime());
                //剩余多少小时
                dto.setHour(getHours(nowTime, endDate));
                dto.setSeconds(subSecond(endDate, nowTime));
            }

        }
        result.add(dto);
    }

}
*/
